#!/bin/sh
# This regression test is a part of SIPp.
# Two calls with one Call-ID: when the first ends, its dead call leaves
# the Call-ID to the second, which still gets its answers.
. "`dirname "$0"`/../functions"; init

rm -f ./*_errors.log
sippbg -sf uas.xml -i 127.0.0.1 -p 25820 -m 1 -timeout 12
sippfg -sf uac.xml -i 127.0.0.1 -p 25821 127.0.0.1:25820 -m 2 -r 1 \
    -cid_str fixed -timeout 8 -trace_err >/dev/null 2>&1
status=$?
errors=`cat ./*_errors.log 2>/dev/null`
rm -f ./*_errors.log

case $errors in
    *'Dead call'*) fail "the second call's answer went to the first's dead call" ;;
esac
if test $status -ne 0; then
    fail "UAC failed with $status"
else
    ok
fi
